@extends('layouts.console_header')

@section('title', '商家状态列表')

@section('resources')
    @parent
    <style>
        .user_list_search{overflow: hidden;margin: 10px 20px;}
        .user_list_search input{float: right;width: 200px;height: 30px;border: 1px solid #000;}
        .user_list_search .user_list_searchbtn{float: right;height: 30px;margin-left: 10px;width: 50px;background-color: #9955c6;color: #fff;border: none;}
        .user_list_pageouter{overflow: hidden;background-color: #fff;}
        .user_list_page{float: right;overflow: hidden;}
        .user_list_page a{float: left;width: 40px;height: 30px;line-height: 30px;text-align: center;}
        .user_list_page .show{background-color: #eee;border: 1px solid #ccc;}
        .display{text-align: center;background-color: #fff;border-collapse:collapse;}
        .display th{padding: 20px 0;}
        .display #tbody_content{border-top: 1px solid #000;border-bottom: 1px solid #000;font-size: 14px;}
        .display #tbody_content tr:nth-child(2n+1){border-bottom: 1px solid #ddd;background-color: #f9f9f9;}
        .display #tbody_content tr:nth-child(2n){border-bottom: 1px solid #ddd;}
        .display #tbody_content tr td{padding: 10px 0;}
        .display #tbody_content tr td:nth-child(1){background-color: #f1f1f1;}
    </style>
@endsection

@section('content')
<section class="user_list">
    <p class="fz_14 account_title">
        <span style="color: #7f7f7f;"><a href="/console/index">首页</a>>商家版运营></span>
        <span class="co_violet">商家状态列表</span>
    </p>

    <p class="user_list_search">
        <input class="user_list_searchbtn" type="button" name="submit_search" value="搜索">
        <input type="text" name="search" value="{{$search}}" placeholder="搜索">
    </p>
    <table class="display" cellspacing="0" width="100%">
        <thead>
            <tr>
                <th>序号</th>
                <th>城市</th>
                <th>商家代码</th>
                <th>商家名称</th>
                <th>当前级别</th>
                <th>当前状态</th>
                <th>更新时间</th>
                {{--<th>操作人</th>--}}
                <th style="width: 120px;">操作</th>
            </tr>
        </thead>
        <tfoot>
            <tr>
                <th>序号</th>
                <th>城市</th>
                <th>商家代码</th>
                <th>商家名称</th>
                <th>当前级别</th>
                <th>当前状态</th>
                <th>更新时间</th>
                {{--<th>操作人</th>--}}
                <th>操作</th>
            </tr>
        </tfoot>
        <tbody id="tbody_content">
            @foreach($lists as $list)
                <tr>
                    @if(!isset($i))
                        <td>{{$i=($page-1)*50 + 1}}</td>
                    @else
                        <td>{{++$i}}</td>
                    @endif
                    <td>{{$list['cityname']}}</td>
                    <td>{{$list['code']}}</td>
                    <td>{{$list['shopname']}}</td>
                    {{--<td>A级</td>--}}
                    <td>{{$list['grade']}}</td>
                @if($list['status'])
                    <td>在线</td>
                @else
                    <td>下架</td>
                @endif
                    <td>{{date('Y-m-d H:i', strtotime($list['created_at']))}}</td>
{{--                    <td>{{$list['adminname']}}</td>--}}
                    <td>
                        <a class="details co_violet" href="/console/shop/get?shopid={{$list['shopid']}}">详情</a>
                        <a style="margin: 0 10px;" class="co_violet" href="/console/shop/daily/record?cityid={{$cityid}}&shopid={{$list['shopid']}}">日志</a>
                        {{--<a class="shop_delete co_red" href="#">删除</a>--}}
                    </td>
                </tr>
            @endforeach
        </tbody>
    </table>
    <div class="user_list_pageouter">
        <p class="user_list_page">
            <a href="/console/shop/status/list?cityid={{$cityid}}&page=1&search={{$search}}">首页</a>
            @if($lastpage <=5)
                @for($i=1; $i<=$lastpage; $i++)
                    @if($page == $i)
                        <a href="/console/shop/status/list?cityid={{$cityid}}&page={{$i}}&search={{$search}}" class="show">{{$i}}</a>
                    @else
                        <a href="/console/shop/status/list?cityid={{$cityid}}&page={{$i}}&search={{$search}}">{{$i}}</a>
                    @endif
                @endfor
            @else
                @if($page>2)
                    <a href="/console/shop/status/list?cityid={{$cityid}}&page={{$page-2}}&search={{$search}}">{{$page-2}}</a>
                @endif
                @if($page>1)
                    <a href="/console/shop/status/list?cityid={{$cityid}}&page={{$page-1}}&search={{$search}}">{{$page-1}}</a>
                @endif
                <a href="/console/shop/status/list?cityid={{$cityid}}&page={{$page}}&search={{$search}}" class="show">{{$page}}</a>
                @if(($page+5)<$lastpage)
                    <a href="/console/shop/status/list?cityid={{$cityid}}&page={{$page+1}}&search={{$search}}">{{$page+1}}</a>
                    <a href="/console/shop/status/list?cityid={{$cityid}}&page={{$page+2}}&search={{$search}}">{{$page+2}}</a>
                    <a href="/console/shop/status/list?cityid={{$cityid}}&page={{$page+3}}&search={{$search}}">{{$page+3}}</a>
                    <a href="/console/shop/status/list?cityid={{$cityid}}&page={{$page+4}}&search={{$search}}">{{$page+4}}</a>
                    <a href="">....</a>
                    <a href="/console/shop/status/list?cityid={{$cityid}}&page={{$lastpage}}&search={{$search}}">{{$lastpage}}</a>
                @else
                    @for($i=1; $i<=5;$i++)
                        @if($page+$i<=$lastpage)
                            <a href="/console/shop/status/list?cityid={{$cityid}}&page={{$page+$i}}&search={{$search}}">{{$page+$i}}</a>
                        @endif
                    @endfor
                @endif
            @endif
            <a href="/console/shop/status/list?cityid={{$cityid}}&page={{$lastpage}}&search={{$search}}">末页</a>
        </p>
    </div>
</section>
<ul class="delete goup">
    <li>
        <span>确认</span>
        <img class="fr" src="{{env('IMAGE_DOMAIN')}}/images/close_p.png" alt="">
    </li>
    <li style="line-height: 20px;margin-top: 30px;height: 108px;">
        <p class="fz_13">商家上架后，商家可设置自己的翻倍日。确定上架么？</p>
        <p style="margin-top: 15px;"><span style="position: relative;top: -40px;" class="fz_13">备注：</span><textarea style="width: 270px;height: 50px;border: 1px solid #797979;" name="" id="" cols="30" rows="10"></textarea></p>
    </li>
    <li>
        <button style="background-color: #9955c6;color: #fff;" class="fl">确定</button>
        <button class="fr">取消</button>
    </li>
</ul>
<ul class="delete delete1">
    <li>
        <span>确认</span>
        <img class="fr" src="{{env('IMAGE_DOMAIN')}}/images/close_p.png" alt="">
    </li>
    <li>删除商家,请谨慎操作! 确定删除么？</li>
    <li>
        <button style="background-color: #9955c6;color: #fff;" class="fl">确定</button>
        <button class="fr">取消</button>
    </li>
</ul>
@endsection

@section('scriptResources')
    @parent
<!-- js 文件-->
<script>
    var cityid = '{{$cityid}}';
    $(document).ready(function(){
        $(".goup li img").click(function(){
            $(".goup").hide();
        })
        $(".shop_delete").click(function(){
            $(".delete1").show();
        })
        $(".delete1 li img").click(function(){
            $(".delete1").hide();
        })
    })
    $(".user_list_searchbtn").click(function() {
        var search=$("input[name='search']").val();
//        if(search == '') {
//            return;
//        }
        window.location.href = "/console/shop/status/list?cityid="+cityid+"&search="+search+"&now=" + Date.parse(new Date());
    });
</script>
@endsection